package com.pc.web.boardEvent;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


@Repository
public class BoardEventDAO {
	@Autowired private SqlSession sql;
	public int insert(BoardEventBeans beans){
		return sql.insert("boardEvent.insert", beans);
	}
	//리스트
	public List<BoardEventBeans> select(){
		return sql.selectList("boardEvent.select");
	}
	//글 상세보기
	public BoardEventBeans detailView(String boardEvent_no) {
		return sql.selectOne("boardEvent.detailView", boardEvent_no);
	}
	//글 수정상세보기
	public BoardEventBeans modifyView(String boardEvent_no) {
		return sql.selectOne("boardEvent.modifyView", boardEvent_no);
	}
	//글 업데이트
	public int update(BoardEventBeans beans) {
		return sql.update("boardEvent.modify", beans);
	}
	//글 삭제
	public void delete(String boardEvent_no) {
		sql.delete("boardEvent.delete", boardEvent_no);
	}
	//글 총수
	public int getListCount(){
		return sql.selectOne("boardEvent.listcount");
	}
	public List<BoardEventBeans> getBoardEventList(BoardEventBeans beans){
		return sql.selectList("boardEvent.boardEventlist", beans);
	}
	//조회수 업데이트
	public void countUpdate(String boardEvent_no){
		sql.update("boardEvent.countUpdate", boardEvent_no);
	}
	//댓글삭제
	public void commentDelete(String boardEvent_number){
		sql.delete("boardEvent.commentDelete", boardEvent_number);
	}
	//덧글입력
	public int commentInsert(BoardEventBeans beans){
		return sql.insert("boardEvent.comment", beans);
	}
	//댓글 리스트
	public List<BoardEventBeans> commentView(String boardEvent_no) {
		return sql.selectList("boardEvent.commentView", boardEvent_no);
	}
	//댓글 가져오기
	public List<String> commentList(String boardEvent_no){
		return sql.selectList("boardEvent.commentList", boardEvent_no);
	}
}